package OOPAndMultiThreadArchiveManager.Server.Models;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class ApiResponse {
    public ApiCode apiCode;
    public Object data;
    public enum ApiCode {
        Success,
        Failed,
        Unauthorized
    }
    public ApiResponse(ApiCode apiCode, Object data) {
        this.apiCode = apiCode;
        this.data = data;
    }

    @JsonIgnore
    public static ApiResponse Success(Object data) {
        return new ApiResponse(ApiCode.Success, data);
    }

    @JsonIgnore
    public static ApiResponse Failed(Object data) {
        return new ApiResponse(ApiCode.Failed, data);
    }

    @JsonIgnore
    public static ApiResponse Unauthorized() {
        return new ApiResponse(ApiCode.Unauthorized, null);
    }


}
